package com.xls.app.service.impl;

import com.xls.app.bean.Book;
import com.xls.app.dao.BookDao;
import com.xls.app.service.BookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BookServiceImpl implements BookService {
    @Autowired
    private BookDao bookDao;

    @Override
    public List<Book> listPageBooks(int page, int size, String bname) {
        return bookDao.listPage((page-1)*size,size,bname);
    }

    @Override
    public int countBooks(String bname) {
        return bookDao.count(bname);
    }

    @Override
    public boolean saveBook(Book book) {
        return bookDao.save(book)>0;
    }

    @Override
    public boolean removeBook(List<Integer> list) {
        return bookDao.remove(list)>0;
    }

    @Override
    public boolean updateBook(Book book) {
        return bookDao.update(book)>0;
    }
}
